package com.example.mapper;

import com.example.entity.vo.CustomerOrder;
import com.example.entity.vo.SalesAdvice;
import com.example.entity.yifei.Coptg;
import com.example.entity.yifei.Copth;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * @author : ssy
 * @date: 2024-04-24
 * @Description:
 */
public interface SalesMapper {

    @Select("SELECT MA050 FROM CMSMA")
    String isSalesAdvice();

    @Select("SELECT MG004 FROM CMSMF             " +
            "LEFT JOIN CMSMG ON MF001 = MG001 \n" +
            "            WHERE MF001 =  #{currency} \n" +
            "            AND MG002 = (SELECT MAX(MG002) FROM CMSMG)")
    Double selectHL(String currency);

    Map<String, Object> getBodyInfo(String order);

    List<SalesAdvice> getSalesAdviceByCode(String code, String deptNo, String currency, String factory, String tax, String rate);

    void insertCoptg(Coptg coptg);

    void insertCopth(Copth copth);

    @Delete("DELETE FROM COPTG WHERE TG001 = #{tg001} AND TG002 = #{tg002}")
    void deleteCoptg(Coptg coptg);

    @Delete("DELETE FROM COPTH WHERE TH001 = #{th001} AND TH002 = #{th002} AND TH003 = #{th003}")
    void deleteCopth(Copth copth);

    Map<String, Object> getBodyInfoByOrder(String order);

    List<CustomerOrder> getOrderByCode(String code, String deptNo, String currency, String factory, String tax);
}
